package com.github.dongglin.smart.spring.boot.plus.common.exception;


import com.github.dongglin.smart.spring.boot.plus.common.enums.BusinessCode;

/**
 * Service 内部接口异常类
 *
 * @author gengjiaping
 * @date 2021-8-13
 **/
public class InnerException extends RuntimeException {

    private String code;

    protected Object data;

    /**
     * 构造函数
     */
    public InnerException() {
        super();
    }

    /**
     * 信息
     *
     * @param msg
     */
    public InnerException(final String msg) {
        super(msg);
    }

    /**
     * @param msg   信息
     * @param cause 原因
     */
    public InnerException(final String msg, final Throwable cause) {
        super(msg, cause);
    }

    /**
     * @param businessCode businessCode
     */
    public InnerException(final BusinessCode businessCode) {
        super(businessCode.getMsg());
        this.code = businessCode.getCode();
    }

    /**
     * @param businessCode b
     * @param data         d
     */
    public InnerException(final BusinessCode businessCode, Object data) {
        super(businessCode.getMsg());
        this.code = businessCode.getCode();
        this.data = data;
    }

    public String getCode() {
        return code;
    }

}
